package com.yaozheng.vocationaltraining.service.impl;

import net.sf.json.JSONObject;

import org.androidannotations.annotations.Background;
import org.androidannotations.annotations.EBean;

import com.yaozheng.vocationaltraining.iview.IBaseView;
import com.yaozheng.vocationaltraining.iview.ICheckpointsTripView;
import com.yaozheng.vocationaltraining.iview.IOnlineExamView;
import com.yaozheng.vocationaltraining.iview.ITokenBaseView;
import com.yaozheng.vocationaltraining.service.CheckpointsTripService;
import com.yaozheng.vocationaltraining.utils.Constants;
import com.yaozheng.vocationaltraining.utils.ErrorUtils;
import com.yaozheng.vocationaltraining.utils.http.okhttp.OkHttpClientManager;

/***
 * 闯关服务
 *
 * @author Administrator
 */
@EBean
public class CheckpointsTripServiceImpl implements CheckpointsTripService {
    ICheckpointsTripView iTokenBaseView;

    @Override
    public void init(ICheckpointsTripView iTokenBaseView) {
        this.iTokenBaseView = iTokenBaseView;
    }


    @Background
    @Override
    public void getSchedule(int id) {
        try {
            OkHttpClientManager.getInstance().get(
                    Constants.ROOTURL + "/exam/master/info?id=" + id,
                    iTokenBaseView.getToken(), iTokenBaseView);
        } catch (Exception e) {
            ErrorUtils.outErrorLog(e);
            if (iTokenBaseView.isResponseResult()) {
                iTokenBaseView
                        .responseError(ErrorUtils.SERVER_CONNECTION_ERROR);
            }

        }
    }

}
